<?php
/**
 * appRain v 0.1.x
 *
 * LICENSE
 *
 * This source file is subject to the MIT license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.opensource.org/licenses/mit-license.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@apprain.com so we can send you a copy immediately.
 *
 * @copyright  Copyright (c) 2010 appRain, Team. (http://www.apprain.com)
 * @license    http://www.opensource.org/licenses/mit-license.php MIT license
 *
 * HELP
 *
 * Official Website
 * http://www.apprain.com/
 *
 * Download Link
 * http://www.apprain.com/download
 *
 * Documents Link
 * http ://www.apprain.com/docs
 */

    // Render Top Tool Bar
    App::Helper('Toolbar')->setTitle("PHP Info")->setBtnBack()->Render(array('code'=>'php_info_bottom'));
    
    ob_start();
    phpinfo();
    $s = ob_get_contents();
    ob_end_clean();
    
    $a = $mtc = array();
    if (preg_match_all('/<tr><td class="e">(.*?)<\/td><td class="v">(.*?)<\/td>(:?<td class="v">(.*?)<\/td>)?<\/tr>/',$s,$mtc,PREG_SET_ORDER))
    {
        foreach($mtc as $v)
        {
            if($v[2] == $this->get_tag('i',NULL,'no value'))continue;
            $a[$v[1]] = $v[2];
        }
    }    
    
    $dataGrid = App::Module('DataGrid')->setDisplay('FormListing');
    foreach( $a as $key => $val)$dataGrid->addRow($key,$val);
    $dataGrid->Render();
    
    // Render Bottom Tool Bar
    App::Helper('Toolbar')->setBtnBack()->Render(array('code'=>'php_info_bottom'));